Page({
  /**
   * 页面的初始数据
   */
  data: {
    exchangeRecords: null
  },

  onLoad: function (options) {
    //从后端获取兑换奖品信息
    this.getExchangeRecords();
  },

    // 从后端获取兑换奖品信息
    getExchangeRecords: function () {
      wx.request({
        url: 'http://localhost:9020/couponIntegral-service/consumer/giftExchange/queryGiftExchangeList',  
        method: 'GET',
        header: {
          'content-type': 'application/json'  // 根据实际情况设置header
        },
        success: (res) => {
          if (res.statusCode === 200) {  // 确认响应状态码
            const exchangeRecords = res.data;  // 假设后端返回的数据结构中有records字段
            this.setData({
              exchangeRecords: exchangeRecords
            });
            console.log(exchangeRecords)
          } else {
            console.error('获取奖品信息失败:', res);
          }
        },
        fail: (err) => {
          console.error('请求失败:', err);
        }
      });
    },
});